import { RouteRecordRaw } from 'vue-router';
import { AsideMenuPath, AsideMenuRouter, BasicRouter, HeaderRouterPath } from '@/router/types';

const dateShowRoutes = [
  {
    path: AsideMenuRouter.INFECTIOUSDISEASES,
    name: 'infectiousDiseases',
    component: () => import('@/views/dataShow/InfectiousDiseases.vue'),
    redirect: AsideMenuPath.CLASSA,
    children: [
      {
        path: AsideMenuRouter.CLASSA,
        name: 'classA',
        component: () => import('@/views/dataShow/ClassA.vue'),
        meta: {
          title: 'message.dataShow.asideMenu.classA',
        },
      },
      {
        path: AsideMenuRouter.CLASSB,
        name: 'classB',
        component: () => import('@/views/dataShow/ClassB.vue'),
        meta: {
          title: 'message.dataShow.asideMenu.classB',
        },
      },
      {
        path: AsideMenuRouter.CLASSC,
        name: 'classC',
        component: () => import('@/views/dataShow/ClassC.vue'),
        meta: {
          title: 'message.dataShow.asideMenu.classC',
        },
      },
    ],
  },
  {
    path: AsideMenuRouter.GENERALDISEASE,
    name: 'generalDisease',
    redirect: AsideMenuPath.EPIDEMICDISEASE,
    component: () => import('@/views/dataShow/GeneralDisease.vue'),
    children: [
      {
        path: AsideMenuRouter.EPIDEMICDISEASE,
        name: 'epidemicDisease',
        component: () => import('@/views/dataShow/EpidemicDisease.vue'),
        meta: {
          title: 'message.dataShow.asideMenu.epidemicDisease',
        },
      },
      {
        path: AsideMenuRouter.CHRONICDISEASE,
        name: 'chronicDisease',
        component: () => import('@/views/dataShow/ChronicDisease.vue'),
        meta: {
          title: 'message.dataShow.asideMenu.chronicDisease',
        },
      },
    ],
  },
  {
    path: AsideMenuRouter.EARLYWARNING,
    name: 'earlyWarning',
    component: () => import('@/views/dataShow/EarlyWarning.vue'),
    meta: {
      title: 'message.dataShow.asideMenu.earlyWarning',
    },
  },
] as RouteRecordRaw[];

export default [
  {
    path: HeaderRouterPath.HOME,
    name: BasicRouter.HOME,
    component: () => import('@/views/Home.vue'),
    meta: {
      title: 'message.front.home',
    },
  },
  {
    path: HeaderRouterPath.LOGIN,
    name: BasicRouter.LOGIN,
    component: () => import('@/views/Login.vue'),
    meta: {
      title: 'message.basic.login',
    },
  },
  {
    path: HeaderRouterPath.DATASHOW,
    name: 'DataShow',
    component: () => import('@/views/DataShow.vue'),
    redirect: AsideMenuPath.INFECTIOUSDISEASES,
    meta: {
      title: 'message.front.dataShow',
    },
    children: [...dateShowRoutes],
  },
  {
    path: HeaderRouterPath.DATACOLLECTION,
    name: 'DataCollection',
    component: () => import('@/views/DataCollection.vue'),
    meta: {
      title: 'message.front.dataCollection',
      requiresAuth: true,
    },
  },
  {
    path: '/profile',
    name: 'Profile',
    component: () => import('@/views/Profile.vue'),
    meta: {
      title: 'message.front.profile',
      hiddenHeaderMenu: true,
    },
  },
  {
    path: '/useragreement',
    name: 'UserAgreement',
    component: () => import('@/views/UserAgreement.vue'),
    meta: {
      title: 'message.front.userAgreement',
      hiddenHeaderMenu: true,
    },
  },
  {
    path: '/displaypage',
    name: 'DisplayPage',
    component: () => import('@/views/DisplayPage.vue'),
    meta: {
      title: 'message.front.displayPage',
      hiddenHeaderMenu: true,
    },
  },
] as RouteRecordRaw[];
